<?php
$this->breadcrumbs=array(
	'獎品管理'=>array('admin'),
	'獎品詳情',
);
Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/css/styles.css');
$this->menu=array(
	array('label'=>'新增獎品', 'url'=>array('create')),
	array('label'=>'獎品列表', 'url'=>array('admin')),
);
$this->widget('application.extensions.fancybox.EFancyBox', array('target' => '.fan1', 'config' => array('width' => 500, 'height' => 250,'type'=>'iframe','hideOnOverlayClick'=>false,'onClosed'=>'js:function(){window.location.href="'.Yii::app()->createUrl("prize/view",array("id"=>$model->prizeid)).'";}')));
?>
<style>
table.detail-view td{
	vertical-align:middle;
}
</style>
<h1>View Prize #<?php echo $model->prizeid; ?></h1>
<table class="detail-view">
	<tbody>
		<tr class="odd">
			<td width="16%">ID</td>
			<td width="34%">
				<?= $model->prizeid ?>
			</td>
			<td width="16%">名稱</td>
			<td>
				<?= $model->prizename ?>
			</td>
		</tr>
		<tr class="even">
			<td>排序</td>
			<td>
				<?= $model->hot ?>
			</td>
			<td>狀態</td>
			<td>
				<?= $model->status ?>
			</td>
		</tr>
		<tr class="odd">
            <td>創建時間</td>
            <td><?= $model->dateline ?></td>
            <td>更新時間</td>
            <td><?= $model->updated ?></td>
        </tr>
		<tr class="even">
            <td>圖片</td>
            <td colspan="3"><img src="<?=Yii::app()->params['prizePath']?>/<?=$model->pic?>" width="100" /></td>
        </tr>
		<tr class="odd">
            <td>詳細介紹</td>
            <td colspan="3"><?=Helper::truncate_utf8_string($model->description,400)?></td>
        </tr>
	</tbody>
</table>
<div style="text-align:right; padding:10px 10px 0 0; font-weight:bold;"><a class='fan1' href="<?=Yii::app()->createUrl('prize/popAddPic',array('prizeid'=>$model->prizeid))?>">增加圖片</a></div>
<?php
if($model->pics){
?>
<table class="detail-view">
    <tbody>
		<tr class="head">
            <td>圖片</td>
			<td width="10%" style="text-align:center;">Delete</td>
        </tr>
<?php
	$i = 0;
	$cssArr = array(0 => 'odd', 1 => 'even');
	foreach($model->pics as $row){
		$trClass = $cssArr[$i % 2];
		$i++;
?>
        <tr class="<?= $trClass ?>">
            <td><img src="<?=Yii::app()->params['prizePath']?>/<?= $row->path ?>" width="100" /></td>
			<td width="10%" style="text-align:center;"><a href="<?=Yii::app()->createUrl('prize/delPic',array('id'=>$row->ppid,'prizeid'=>$model->prizeid))?>">Delete</a></td>
        </tr>
<?php        
	}
?>
    </tbody>
</table>
<?php
}
?>